﻿using System.Data;

namespace Marmat.Forms.Views
{
    namespace DataGrid
    {
        public class RowColEventArgs : Grid.RowColEventArgs
        {

            private Row m_Row;
            private readonly Column m_Column;

            internal RowColEventArgs(Forms.DataGrid gridControl, int rowHandle, Column column) : base(gridControl, rowHandle, column)
            {
                this.m_Column = column;
            }

            /// <summary>
            /// 返回当前 DataGrid。
            /// </summary>
            public new Forms.DataGrid GridControl
            {
                get
                {
                    return (Forms.DataGrid)base.GridControl;
                }
            }

            /// <summary>
            /// 返回准备编辑的行。
            /// </summary>
            public new Row Row
            {
                get
                {
                    if (this.m_Row is null)
                    {
                        DataRowView RowView = (DataRowView)base.Row;
                        this.m_Row = new Row(this.GridControl, RowView.Row);
                    }
                    return this.m_Row;
                }
            }

            /// <summary>
            /// 返回准备编辑的列。
            /// </summary>
            public new Column Column
            {
                get => this.m_Column;
            }

            /// <summary>
            /// 获取当前单元格的值。
            /// </summary>
            public object CellValue
            {
                get => this.Row[this.Column];
            }
        }
    }
}